<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>确定人选</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="stylesheet" href="../layui/css/layui.css">
    <link rel="stylesheet" href="../css/reset.css">
    <link rel="stylesheet" href="../css/CSS.css">
    <script src="../js/jquery-3.3.1.js"></script>
    <script src="../layui/layui.all.js"></script>
    <script src="../layui/layui.js"></script>
    <script src="../js/JS.js"></script>
</head>
<body>
<header>
    <a href="javascript:history.back(-1)" class="back"><img src="../img/back.png" height="18px"></a>
    <div class="center title">确定约会人选</div>
</header>
<div class="apponitment">

</div>
</body>
</html>
<script>
    $('.apponitment_btn').on('click',function () {
            layer.msg('选择成功',{icon:6,time:800});
    });
     function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(r[2]); return null; //返回参数值
        }
        //接收URL中的参数id
        var id = getUrlParam('id');
        console.log(id);


        $.ajax({
            url:"/meiyou/selYhask",
            data:{yId:id},
            type:"post",
            success:function(data){
                console.log(data);
                $.each(data,function(i,val){
                     $('.apponitment').append(" <ul class=\"apponitment_ul clearfix\">\n" +
                    "        <li class=\"fl\"><img src='"+val.u_img+"' alt=\"\"></li>\n" +
                    "        <li class=\"fl\">\n" +
                    "            <p><span class=\"username\">"+val.y_u_count+"</span><i class=\"age\"><img src=\"../img/female-s.png\" alt=\"\">"+val.u_old+"</i></p>\n" +
                   
                    "        </li>\n" +
                    "        <li class=\"fr\"><input type=\"button\" id='"+val.y_id+"' value=\"确定\" class=\"apponitment_btn\"></li>\n" +
                    "    </ul>")
                })
               
            }
        });
        $(document).on('click','.apponitment_btn',function(){
           var xCount=$(this).parent().prev().find('.username').text();
           var y_id=$(this).attr('id');
           console.log(xCount);
           console.log(y_id);
            $.post('/meiyou/updYhState',{xCount:xCount,yId:y_id},function(data){
                console.log(data);
            });

        });
</script>
